'
“equals” method should be added to all classes. Use your judgment to add setters, getters or other methods as needed. Design a class named Person and its two subclasses named Student and Faculty. Person class should have: • name, age, and email. • Constructor which takes 3 parameters for name, age and email. Student class should have: • Major and gpa. • Constructor which sets all necessary data in Person and Student class. • toString method that lists student name, age, email, major and gpa. • Method to register for a course. The method should make sure that the course has not reached max capacity and the student is not already in the course. Otherwise sysout a message and reject the student. Message can be generic. It is optional to specify the reason of rejection. (There is a method in the Course class that uses the same logic. Try to not duplicate it. Define the method either here or in Course class, then invoke it from the other place.) Faculty class should have: • Department and office. • toString method that lists faculty name, age, email, department and office • Constructor which sets all necessary data in the Person and Faculty class. Design a class named Course. Course class should have: • department, course name, max class size, current enrollment number, roster (an array of students) and instructor. • Constructor which takes 3 parameters for department, course name, and max class size. • toString method that lists course name, department, max class size, current enrollment number and instructor if one has been assigned. • Method to display the class roster. Page 2 of 2 • Method to add one student at a time to the course. The method should make sure that the course has not reached max capacity and the student is not already in the course. Otherwise sysout a message and reject the student. Message can be generic. It is optional to specify the reason of rejection. (There is a method in the Student class that uses the same logic. Try to not duplicate it. Define the method either here or in Student class, then invoke it from the other place.) • Method to assign an instructor to the class. Only the instructor from the same department can be assigned to the course. Use provided RegistrationDemo.java to test run your code.
Here is the provide code this needs to be working please help??
package mp6; public class RegistrationDemo { public static void main(String[] args) { // TODO Auto-generated method stub //construct some students: Student jane = new Student("Jane",20,"jane@wccnet.edu","Computer Science",3.45); Student kurtis = new Student("Kurtis",36,"kurtis@wccnet.edu","Math",3.60); Student teddy = new Student("Teddy",25,"Teddy@wccnet.edu","Computer Science",3.20); Student mike = new Student("Mike",22,"Mike@wccnet.edu","Biology",3.58); Student sally = new Student("Sally",40,"Sally@wccnet.edu","Computer Science",3.80); Student nicole = new Student("Nicole",18,"kurtis@wccnet.edu","Physics",3.20); //construct course: Course introJava = new Course("CSIT","Intro Java",5); System.out.println("------display course and roster:-----"); System.out.println(introJava); introJava.displayRoster(); //construct faculty: Faculty jing = new Faculty("Jing",40,"jswanson@wccnet.edu","CSIT","BE231"); Faculty jim = new Faculty("Jim",35,"jim@wccnet.edu","MATH","GM200"); System.out.println("\\n\\n------assign instructor to the course:-----"); introJava.assignInstructor(jim); introJava.assignInstructor(jing); System.out.println("\\n\\n------display course again:-----"); System.out.println(introJava); System.out.println("\\n\\n------adding some students to the course:-----"); introJava.addStudent(jane); introJava.addStudent(kurtis); introJava.addStudent(kurtis); teddy.registerCourse(introJava); introJava.addStudent(teddy); System.out.println("\\n\\n------display course again:-----"); System.out.println(introJava); System.out.println("\\n\\n------display roster:-----"); introJava.displayRoster(); System.out.println("\\n\\n------adding more students to the course:-----"); mike.registerCourse(introJava); sally.registerCourse(introJava); nicole.registerCourse(introJava); System.out.println("\\n\\n------display roster:-----"); introJava.displayRoster(); } }
'